<template>
  <el-dialog append-to-body :close-on-click-modal="false" :before-close="crud.cancelCU" :visible="crud.status.cu > 0" :title="crud.status.title" width="700px">
    <el-form ref="form" :model="form" :rules="rules" size="small" label-width="120px">
      <el-form-item label="类型别名">
        <el-input v-model="form.keyTypeAlias" />
      </el-form-item>
      <el-form-item label="关键词">
        <el-input v-model="form.keyTxts" />
      </el-form-item>
      <el-form-item label="请求地址">
        <el-input v-model="form.requestUrl" />
      </el-form-item>
      <el-form-item label="请求方式">
        <el-select v-model="form.requestMethod" filterable placeholder="请选择">
          <el-option v-for="item in dict.dict.type_common_http_method" :key="item.dictValue" :label="item.dictLabel" :value="item.dictValue" />
        </el-select>
      </el-form-item>
      <el-form-item label="请求IP">
        <el-input v-model="form.requestIp" />
      </el-form-item>
      <el-form-item label="请求参数">
        <el-input v-model="form.requestParam" />
      </el-form-item>
      <el-form-item label="请求参数值">
        <el-input v-model="form.requestParamValue" />
      </el-form-item>
      <el-form-item label="请求用户ID">
        <el-input v-model="form.requestUserId" />
      </el-form-item>
      <el-form-item label="请求用户名称">
        <el-input v-model="form.requestUserName" />
      </el-form-item>
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button type="text" @click="crud.cancelCU">取消</el-button>
      <el-button :loading="crud.status.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
    </div>
  </el-dialog>
</template>

<script>
import { form } from '@crud/crud'

const defaultForm = { id: null, keyTypeAlias: null, keyTxts: null, requestUrl: null, requestMethod: null, requestIp: null, requestParam: null, requestParamValue: null, requestUserId: null, requestUserName: null }
export default {
  mixins: [form(defaultForm)],
  props: {
    dict: {
      type: Object,
      required: true
    }
  },
  data() {
    return {
      rules: {
      }
    }
  }
}
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
  /deep/ .el-input-number .el-input__inner {
    text-align: left;
  }
</style>
